<?php

add_action('wp_dashboard_setup', 'remove_dashboard_widgets');


add_action('admin_bar_menu', 'wp_admin_bar_my_custom_account_menu', 11); //for welcome menu + removing side menu + fix container margin & remove help & screen option. 
add_action('admin_menu', 'wphidenag');



if (check_dktm_user(true)) {
    add_action( 'admin_menu', 'remove_menus' );
    add_action('wp_before_admin_bar_render', 'custom_toolbar', 999); //fix menu item
//    add_action('profile_personal_options', 'yoursite_extra_user_profile_fields');
//    add_action('show_user_profile', 'yoursite_extra_user_profile_fields');
//    add_action('edit_user_profile', 'yoursite_extra_user_profile_fields');
    remove_action('admin_color_scheme_picker', 'admin_color_scheme_picker');
    add_action('admin_notices', 'my_custom_dashboard'); //for dashboard content 
}
add_filter('admin_footer_text', 'remove_footer_admin'); //for footer content
add_filter('update_footer', 'my_footer_version', 11); //version
    function custom_toolbar() {
        include(TEMPLATEPATH . '/templates/admin-toolbar.php');
    }
    function remove_menus(){
         remove_menu_page( 'edit.php?post_type=tribe_events' );
    }
function remove_dashboard_widgets() {
    global $wp_meta_boxes;
    unset($wp_meta_boxes['dashboard']['side']['core']);
    unset($wp_meta_boxes['dashboard']['normal']['core']);
}

function wp_admin_bar_my_custom_account_menu($wp_admin_bar) {
    $user_id = get_current_user_id();
    $current_user = wp_get_current_user();
    $profile_url = get_edit_profile_url($user_id);
    if (0 != $user_id) {
        /* Add the "My Account" menu */
//            $avatar = get_avatar($user_id, 28);
//            $class = empty($avatar) ? '' : 'with-avatar';  
        $class = '';
        $howdy = sprintf(__('Welcome, %1$s'), $current_user->display_name);

        $wp_admin_bar->add_menu(array(
            'id' => 'my-account',
            'parent' => 'top-secondary',
            'title' => $howdy,
//                'title' => $howdy . $avatar,
            'href' => $profile_url,
            'meta' => array(
                'class' => $class,
            ),
        ));
    }
}

function wphidenag() {
    remove_action('admin_notices', 'update_nag', 3);
}

function my_custom_dashboard() {
    include(TEMPLATEPATH . '/templates/admin-dashboard.php');
}

function remove_footer_admin() {
    echo 'Copyright &copy; 2014 <a href="' . get_site_url() . '" target="_blank">Direction Kathmandu.</a>.';
}

function my_footer_version($default) {
    return '';
//        return 'Not ' . $default;
}

function yoursite_extra_user_profile_fields($user) {
    include TEMPLATEPATH. '/templates/admin-link_to_homepage.php';
}